import {NavigatorRoutePage, NavigatorRouteType} from "plain-micro-application";
import {decodeHref, matchNavigatorRoutes} from "plain-micro-application";
import {nav} from "@/micro/nav/nav";

/**
 * 处理home路由以及public路由，通过路径获取页面信息
 * @author  韦胜健
 * @date    2021/4/22 14:49
 */
export function getCommonRoutePage(routeType: NavigatorRouteType): NavigatorRoutePage {
    const hrefInfo = decodeHref()
    const urlPath = hrefInfo.matchPrefix(routeType)
    return {
        ...matchNavigatorRoutes(urlPath, routeType, nav),
        query: hrefInfo.query,
    }
}